package by.averianov.discounta.services;

import java.util.List;
import java.util.Set;

import javax.persistence.metamodel.SingularAttribute;

import org.springframework.transaction.annotation.Transactional;

import by.averianov.discounta.datamodel.Card;
import by.averianov.discounta.datamodel.CardType;
import by.averianov.discounta.datamodel.Shop;
import by.averianov.discounta.datamodel.UserAccount;
import by.averianov.discounta.datamodel.UserProfile;
import by.averianov.discounta.datamodel.enums.AccessGroup;

public interface UserService {
	
	Long getCurrentDate();
	
	String randomString(int size);
    
    @Transactional
    void saveOrUpdateUser(UserProfile profile, UserAccount account);
    
    @Transactional
    void saveOrUpdateShop(Shop shop);
    
    @Transactional
	void saveOrUpdateCard(Card card);
    
    @Transactional
    void saveOrUpdateCardType(CardType cardType);
    
    Shop createShop(Long id, String nameShop);
    
    Long getShopCount();

    Long getUserCount();
    
    Long getCardCount();
    
    Long getCardTypeCount();
    
    @Transactional
    void setShop(Shop shop);
            
    UserAccount createUserAccount(String email, String password, Boolean userStatus, String activateCode);

    UserProfile createUserProfile(Long id, String firstName, String lastName, Long dateCreated, Long phone, AccessGroup accessGroup);
    
    UserProfile createUserProfile(Long id, String firstName, String lastName, Long dateCreated, Long phone);
        
    @Transactional
    void removeUser(Long id);
    
    @Transactional
    void removeCard(Long id);
       
    @Transactional
    void removeShop(Long id);
    
    @Transactional
    void removeCardType(Long id);
    
    @Transactional
    void removeAllUsers();
    
    @Transactional
    void removeAllShops();
    
    @Transactional
    void removeAllCards();
    
    @Transactional
    void removeAllCardTypes();
    
    Shop getShopById(Long id);
    
    Card getCardById(Long id);
    
    CardType getCardTypeById(Long id);
    
    CardType getCardTypeByName(String name);

    List<UserAccount> getAllAccountOrderId();
    
    UserAccount getUserAccount(Long id);
    
    UserProfile getUserProfile(Long id);
    
	Card getCardByUser(Long userId);

	Set<Shop> getAllShopsByUser(Long userId);

	UserAccount getAccountByEmail(String userEmail);
	
	List<UserProfile> getAllUserProfile();

	List<UserProfile> getAllUserProfile(SingularAttribute<UserProfile, ?> attr, boolean ascending, int startRecord, int pageSize);

	List<Shop> getAllShop();
    
    List<Shop> getAllShop(SingularAttribute<Shop, ?> attr, boolean ascending, int startRecord, int pageSize);
    
    List<Card> getAllCard(SingularAttribute<Card, ?> sortParam, boolean ascending, int first, int count);
    
    List<Card> getAllCardByUser(Long id);
    
    List<Card> getAllCardByUser(SingularAttribute<Card, ?> sortParam, boolean ascending, int first, int count, Long id);

	List<CardType> getAllCardType();

	List<CardType> getAllCardType(SingularAttribute<CardType, ?> attr, boolean ascending, int startRecord, int pageSize);
	
  
}
